package com.dha.adapter;

import java.util.ArrayList;
import java.util.List;

import com.dha.caodangcongnghe.R;
import com.dha.model.ThoiKhoaBieuModel;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class XemThoiKhoaBieuAdapter extends ArrayAdapter<ThoiKhoaBieuModel> {
	private Context context;
	private int layout_custom;
	private ArrayList<ThoiKhoaBieuModel> arr;

	public XemThoiKhoaBieuAdapter(Context context, int resource,
			ArrayList<ThoiKhoaBieuModel> objects) {
		super(context, resource, objects);
		this.context = context;
		layout_custom = resource;
		arr = objects;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(context.LAYOUT_INFLATER_SERVICE);
		
		convertView = inflater.inflate(layout_custom, parent, false);
	
		TextView tv_custom_tkb_lop = (TextView) convertView
				.findViewById(R.id.tv_custom_tkb_lop);
		TextView tv_custom_tkb_monHoc = (TextView) convertView
				.findViewById(R.id.tv_custom_tkb_monHoc);
		TextView tv_custom_tkb_thu = (TextView) convertView
				.findViewById(R.id.tv_custom_tkb_thu);
		TextView tv_custom_tkb_tuTiet = (TextView) convertView
				.findViewById(R.id.tv_custom_tkb_tuTiet);
		TextView tv_custom_tkb_denTiet = (TextView) convertView
				.findViewById(R.id.tv_custom_tkb_denTiet);
		TextView tv_custom_tkb_giangVien = (TextView) convertView
				.findViewById(R.id.tv_custom_tkb_giangVien);
		TextView tv_custom_tkb_phong = (TextView) convertView
				.findViewById(R.id.tv_custom_tkb_phong);
		TextView tv_custom_tkb_ngay = (TextView) convertView
				.findViewById(R.id.tv_custom_tkb_ngay);
		
		
		tv_custom_tkb_lop.setText(arr.get(position).getLop().toString());
		tv_custom_tkb_monHoc.setText(arr.get(position).getMonHoc().toString());
		tv_custom_tkb_thu.setText(arr.get(position).getThu().toString());
		tv_custom_tkb_tuTiet.setText(arr.get(position).getTuTiet().toString());
		tv_custom_tkb_denTiet.setText(arr.get(position).getDenTiet().toString());
		tv_custom_tkb_giangVien.setText(arr.get(position).getGiangVien().toString());
		tv_custom_tkb_phong.setText(arr.get(position).getPhong().toString());
		tv_custom_tkb_ngay.setText(arr.get(position).getNgayHieuLuc().toString());
		return convertView;
	}

}
